/*
 *  vector.cc
 *  Untitled
 *
 *  Created by Ben Nolan on 2/11/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#include "vector.h"
#include "errors.h"

#include <sstream>

namespace Wonderland{

Vector::Vector(std::string s){
	char comma;
	std::istringstream iss(s);

	iss >> x >> comma >> y >> comma >> z;
	
	if( (!iss.eof()) || (iss.fail()) ){
		throw Wonderland::Errors::BadSerialization();
	}
}

std::string Vector::toString() const{
    std::stringstream coord;
    coord << x << ",";
    coord << y << ",";
    coord << z;
    return coord.str();
}

std::ostream& operator << (std::ostream &os,const Vector v){
	  os << v.toString();
	  return os;
}

}